package com.zy.web.controller.bs;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.zy.entity.bs.LableType;
import com.zy.pojo.query.bs.LableTypeQuery;
import com.zy.pojo.vos.common.PageVo;
import com.zy.pojo.vos.common.ResultVo;
import com.zy.service.bs.LableTypeService;
import com.zy.web.controller.base.BaseController;
import com.zy.web.utils.ResultUtil;

@RequestMapping("bs/lableType")
@Controller
public class LableTypeController extends BaseController {

	@Autowired
	private LableTypeService lableTypeService;

	/**
	 * 分页
 	 * 
 	 * @param lableTypeQuery
	 * @param start
	 * @param limit
	 * @return
	 */
	@RequestMapping("pageLableType")
	@ResponseBody
	public PageVo pageLableType(LableTypeQuery lableTypeQuery, Integer start, Integer limit) {
		return this.lableTypeService.pageLableType(lableTypeQuery, start, limit);
	}

	/**
	 * 新增
	 * 
	 * @param lableType
	 * @return
	 */
	@RequestMapping(value = "saveLableType", method = RequestMethod.POST)
	@ResponseBody
	public ResultVo saveLableType(LableType lableType) {
		try {
			this.lableTypeService.saveLableType(lableType);
			return ResultUtil.success();
		} catch (Exception e) {
			return ResultUtil.error(log, e);
		}
	}
	
	/**
	 * 更新
	 * 
	 * @param lableType
	 * @return
	 */
	@RequestMapping(value = "updateLableType", method = RequestMethod.POST)
	@ResponseBody
	public ResultVo updateLableType(LableType lableType) {
		try {
			this.lableTypeService.updateLableType(lableType);
			return ResultUtil.success();
		} catch (Exception e) {
			return ResultUtil.error(log, e);
		}
	}

	/**
	 * 删除
	 * 
	 * @param id
	 * @return
	 */
	@RequestMapping(value = "removeLableType", method = RequestMethod.POST)
	@ResponseBody
	public ResultVo removeLableType(long id) {
		try {
			this.lableTypeService.removeLableType(id);
			return ResultUtil.success();
		} catch (Exception e) {
			return ResultUtil.error(log, e);
		}
	}

	/**
	 * 恢复
	 * 
	 * @param id
	 * @return
	 */
	@RequestMapping(value = "recover", method = RequestMethod.POST)
	@ResponseBody
	public ResultVo recover(long id) {
		try {
			this.lableTypeService.recover(id);
			return ResultUtil.success();
		} catch (Exception e) {
			return ResultUtil.error(log, e);
		}
	}

}